<br />
<% if(session[:user_id]!=nil) %>
   	<% @dm = User.find(session[:user_id])%>
   	<% @dm2 = @dm.typeUser %>
   	<%if(@dm2 != '0')%>
<div class='aa' style="float: right; padding-right: 10px; width: 150px; height: 18px;"><%= link_to t(:createbook), new_booktable_path %></div>
<% end%>
    <%end%>
<div class="title"><%= t :listbook%> 
	</div>
<br>
<% if (@booktables.count > 0) %>

  <% @booktables.each do |booktable| %>
    <div class="view">
  <%= link_to image_tag(booktable.image, :border => 0,:width =>270, :height => 340), booktable%><br><br>
    $<%= booktable.nameBook %>
   
<br>
   
   <% if(session[:user_id]!=nil) %>
    
   	<% @dm = User.find(session[:user_id])%>
   	<% @dm2 = @dm.typeUser %>
   	<%if(@dm2 != '0')%>
   		 <%= link_to t(:show), booktable %>|
    	<%= link_to t(:edit), edit_booktable_path(booktable) %>|
    	<%= link_to t(:destroy), booktable, confirm: t(:confirm), method: :delete %>
    	<%else %>
    	<%= link_to t(:borrowbook), :controller => "muonsaches", :action => "new", :id => booktable.id%>
    <% end%>
    <%end%>
    </div>
<% end %>
  
</table>
 <%
 else %> <h3><b><%= t(:nobook)%></b></h3>
 
<%end%>

<br />

